package hxy.bytecode.algorithm;

import java.util.Arrays;

public class 数组求值 {
	public static void main(String args[]) {
		int a[] ={2,7,11,15};
		int target =13;
		int c[] = 数组求值.twoSum(a, target);
		System.out.println(Arrays.toString(c));
	}
	public static int[] twoSum(int[] nums, int target) {
		int[] c = new int[2];
		for (int a : nums) {
			for (int b : nums) {

				if (a != b && (a + b) == target) {
					c[0] = a;
					c[1] = b;
					return c;
				}
			}
		}
		return null;
	}
}
